package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.UserDto;
import com.zzyl.entity.User;
import com.zzyl.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper//不同模块同路径下存在相同的UserMapper，则需要改名
public interface UserSafeMapper {

    int deleteByPrimaryKey(Long id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * 这是Mybatis Generator拓展插件生成的方法(请勿删除).
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     * @author hewei
     */
    int batchInsert(@Param("list") List<User> list);

    Page<List<User>> selectPage(UserDto userDto);

    Page<List<UserVo>> getPage(UserDto userDto);

    @Select("select count(id) from sys_user where post_no = #{postId}")
    Integer checkPostHasUser(String postId);

    @Select("SELECT COUNT(1) FROM sys_user where dept_no = #{deptId}")
    int checkDeptExistUser(String deptId);

    @Select("select * from sys_user")
    List<User> selectList();

    @Select("select * from sys_user where username = #{userName}")
    User selectByUserName(String  userName);
}